home *** CD-ROM | disk | FTP | other *** search
- Path: panoramix.fi.upm.es!dia!sacha
- From: sacha@diafi.upm.es (Sacha)
- Newsgroups: comp.lang.c++
- Subject: inheritance of friendship
- Date: 5 Apr 1996 16:06:26 GMT
- Organization: CS Dept., Technical University of Madrid
- Sender: sacha@dia (Sacha)
- Distribution: world
- Message-ID: <4k3ge2$igu@panoramix.fi.upm.es>
- NNTP-Posting-Host: alba.dia.fi.upm.es
-
-
- I've just read in the FAQ that friendship isn't inherited: that is if B is a
- friend of class A, and class C is derived from B, C ISN'T a friend of A.
-
-
- A friends with B
- |
- not friends with C
-
- Is there some way around this?
-
- I am overloading << to output to streams, but I don't want to have to rewrite the
- same function for each different type of stream. I've tried making both B and C
- friends of A and defining the function for B, but this doesn't work.
-
- Should I just forget about overloading << and write an outToStream function
- instead?
-
-
-
- Cheers,
-
-
- Sacha.
-
- --
- "It's not just pork, Gilbert, it's power."
-